package com.matrix.index.ui.setting

import android.webkit.WebView
import android.webkit.WebViewClient
import androidx.activity.enableEdgeToEdge
import com.alibaba.android.arouter.facade.annotation.Route
import com.blankj.utilcode.util.ToastUtils
import com.matrix.basecore.base.BaseActivity
import com.matrix.basecore.constant.Constant
import com.matrix.index.databinding.ActivityAboutUsBinding
import com.matrix.index.databinding.ActivitySettingBinding

@Route(path = Constant.ARouterPath.SettingAboutUsPath)
class AboutUsActivity : BaseActivity<ActivityAboutUsBinding>() {

    override fun getViewBinding(): ActivityAboutUsBinding {
        enableEdgeToEdge()
        return ActivityAboutUsBinding.inflate(layoutInflater)
    }

    override fun initView() {
        mViewBinding.title.tvTitle.text = intent.getStringExtra(Constant.ARouterString.TITLE)
        var path = intent.getStringExtra(Constant.ARouterString.PATH)!!
        mViewBinding.webview.settings.javaScriptEnabled = true
        mViewBinding.webview.let {
            it.loadUrl(path)
            it.webViewClient = object : WebViewClient() {
                override fun onPageFinished(view: WebView, url: String) {
                    super.onPageFinished(view, url)
                    // 页面加载完成后的操作
                }
            }
        }
    }

    override fun initListener() {
        mViewBinding.title.ivBack.setOnClickListener {
            onBackPressedDispatcher.onBackPressed()
        }
    }
}